<!--
 * @Descripttion: 分包首页
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2020-12-17 17:41:02
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-01-19 14:13:08
-->

<template>
  <div v-if="firstProject">
    <Guide @setRead="setRead" />
  </div>
  <div v-else class="container clearfix">
    <!-- 头部信息 -->
    <div class="titleWrap">
      <el-row class="topBox">
        <div class="fl">
          <p class="headertitle">{{ titleprojectName }}</p>
        </div>
        <div class="fl">
          <span
            class="projectState greenBack"
            v-if="topInfo.stateName === '已开工'"
            >已开工</span
          >
          <span
            class="projectState yellowBack"
            v-if="topInfo.stateName === '未开工'"
            >未开工</span
          >
          <span
            class="projectState greyBack"
            v-if="topInfo.stateName === '已竣工'"
            >已竣工</span
          >
          <span
            class="projectState redBack"
            v-if="topInfo.stateName === '已停工'"
            >已停工</span
          >
        </div>
      </el-row>
      <el-row class="explain">
        于
        <span>{{ topInfo.createTime }}</span>
        建档，于
        <span>{{ topInfo.date }}</span>
        开工，建设周期{{ topInfo.period }}天
        <span v-show="topInfo.endDay >= 0">，距离计划竣工还剩</span>
        <span v-show="topInfo.endDay < 0">，超出计划竣工</span>
        <span>{{ Math.abs(topInfo.endDay) || '--' }}</span>
        <span>天</span>
        <el-link type="primary" class="seeDetail" @click="seeProjectDetail"
          >查看项目详情>></el-link
        >
        <!-- <span class="untrue">信息不正确？</span> -->
        <el-link
          v-if="isShowUpdate"
          type="primary"
          class="updateInfo"
          @click="updateProjectInfo"
          >去修改>></el-link
        >
        <el-link class="historyChange" type="primary" @click="toHistoryChange"
          >项目历史状态变更</el-link
        >
      </el-row>
      <el-row class="titleBottom">
        <div class="upload-demo inline-block" style="margin-top: 6px">
          维权公示牌：{{ topInfo.hasUpload }}
        </div>
        <el-upload
          v-if="topInfo.hasUpload === '未上传'"
          class="upload-demo inline-block"
          :action="uploadUrl"
          :data="uploadData"
          :on-success="uploadSuccess"
          :on-error="uploadError"
          :before-upload="limitSize"
          accept=".jpg, .jpeg, .png, .PNG, .JPG, .JPEG"
          list-type="picture"
        >
          <el-link type="primary">点击上传</el-link>
        </el-upload>
        <el-upload
          v-if="topInfo.hasUpload === '已上传'"
          class="upload-demo inline-block"
          :action="uploadUrl"
          :data="uploadData"
          :on-success="changeUploadSuccess"
          :on-error="uploadError"
          :before-upload="limitSize"
          accept=".jpg, .jpeg, .png, .PNG, .JPG, .JPEG"
          list-type="picture"
        >
          <!-- <el-link type="primary">点击替换</el-link> -->
        </el-upload>
        <div class="inline-block previewBox">
          <el-row>
            <el-col :span="12"
              ><el-link
                type="primary"
                v-show="topInfo.hasUpload === '已上传'"
                @click="showPic"
                >点击预览</el-link
              ></el-col
            >
            <!-- <el-col :span="12"> <el-link
            type="primary"
            @click="toHistoryChange"
            >项目历史状态变更</el-link
          ></el-col> -->
          </el-row>
          <el-image
            class="previewImg"
            v-if="topInfo.hasUpload === '已上传'"
            style="width: 56px; height: 0px"
            :src="publicSign.imgUrl"
            :preview-src-list="publicSign.srcList"
            id="publicSignBox"
          ></el-image>
        </div>
      </el-row>
      <!-- 未开工没有项目历史变更 -->
      <!-- <div class="historyChange" @click="toHistoryChange">
          项目历史状态变更
      </div> -->
      <div class="topBtn" v-if="companyType === 'JS'">
        <el-button
          type="danger"
          @click="openDialog('stop')"
          v-show="
            topInfo.state === 'STARTED' ||
            (topInfo.state === 'NOT_STARTED' && isShowUpdate)
          "
          >设置停工</el-button
        >
        <el-button
          type="danger"
          class="greenBack"
          @click="openDialog('over')"
          v-show="
            topInfo.state === 'STARTED' ||
            topInfo.state === 'NOT_STARTED' ||
            (topInfo.state === 'FINISHED' && isShowUpdate)
          "
          >设置竣工</el-button
        >
        <el-button
          type="danger"
          class="greenBack"
          @click="openDialog('againStart')"
          v-show="
            topInfo.state === 'STOPPED' ||
            (topInfo.state === 'NOT_STARTED' && isShowUpdate)
          "
          >设置开工</el-button
        >
        <el-button
          type="danger"
          class="greenBack"
          @click="openDialog('finish')"
          v-show="
            topInfo.state === 'STARTED' ||
            (topInfo.state === 'NOT_STARTED' && isShowUpdate)
          "
          >设置完工</el-button
        >
      </div>
    </div>
    <!-- 主体部分 -->
    <div class="mainSection">
      <!-- 左边模块 -->
      <div class="contentLeft">
        <!-- 待办事项 -->
        <div class="accountBox">
          <el-row>
            <el-col :span="12">
              <div class="title">待办事项</div>
            </el-col>
            <el-col :span="12">
              <div
                class="title see-more"
                style="text-align: right"
                @click="lookMore"
              >
                查看更多 >>
              </div>
            </el-col>
            <el-table
              :row-class-name="tableRowClassName"
              :data="tableData"
              stripe
              style="width: 100%"
            >
              <el-table-column prop="updateTime"> </el-table-column>
              <el-table-column prop="salarySendStr"> </el-table-column>
              <el-table-column prop="statusDesc"> </el-table-column>
              <el-table-column fixed="right" width="100">
                <template slot-scope="scope">
                  <el-button
                    @click="handleClick(scope.row)"
                    type="text"
                    size="small"
                    class="see-more"
                    >去处理>></el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </el-row>
        </div>
        <!-- 人员实时动态 -->
        <div class="reactBox persoformance">
          <div class="title">人员实时动态</div>
          <div class="keyWrapper">
            <!-- 企业端实名制为空的时候显示 -->
            <div v-if="noRealName" class="noRealName">
              <p>
                <i class="iconfont iconjingshi"></i>
                <span>您还没有人员实时动态，请尽快添加！</span>
              </p>
              <el-button
                class="commonBut saveBtn addEmployee"
                icon="iconfont icontianjia"
                @click="addEmployeeDynamic"
              >
                <span class="opetareText">添加人员实时动态</span>
              </el-button>
            </div>
            <ul v-else>
              <li class="keyBox">
                <p class="keyName">当前在职人数</p>
                <p>
                  <span class="quantity">{{ employeeInfo.onJob || '0' }}</span>
                  <span class="keyName">人</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">当前离职人数</p>
                <p>
                  <span class="quantity">{{
                    employeeInfo.departure || '0'
                  }}</span>
                  <span class="keyName">人</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">当前在场人数</p>
                <p>
                  <span class="quantity">{{
                    employeeInfo.presence || '0'
                  }}</span>
                  <span class="keyName">数</span>
                </p>
              </li>
            </ul>
          </div>
        </div>
        <!-- 实名制管理制度落实情况 -->
        <div class="reactBox">
          <div class="title">实名制管理制度落实情况</div>
          <div class="keyWrapper">
            <!-- 企业端实名制为空的时候显示 -->
            <div v-if="noRealName" class="noRealName">
              <p>
                <i class="iconfont iconjingshi"></i>
                <span>您还没有实名制管理制度落实情况，请尽快添加！</span>
              </p>
              <el-button
                class="commonBut saveBtn addEmployee"
                icon="iconfont icontianjia"
                @click="addEmployeemanage"
              >
                <span class="opetareText">添加实名制管理制度落实情况</span>
              </el-button>
            </div>
            <ul v-else>
              <li class="keyBox">
                <p class="keyName">实名制总人数</p>
                <p>
                  <span class="quantity">{{
                    managesystem.projectRealNameTotalCount || '0'
                  }}</span>
                  <span class="keyName">人</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">本月新增人数</p>
                <p>
                  <span class="quantity">{{
                    managesystem.projectThisMonthRealNameCount || '0'
                  }}</span>
                  <span class="keyName">人</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">总考勤数</p>
                <p>
                  <span class="quantity">{{
                    managesystem.projectTotalAttCount || '0'
                  }}</span>
                  <span class="keyName">次</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">本月考勤数</p>
                <p>
                  <span class="quantity">{{
                    managesystem.projectThisMontAttCount || '0'
                  }}</span>
                  <span class="keyName">次</span>
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">实名制合同签订比例</p>
                <p class="quantity">
                  {{ managesystem.signNameContractReal || '0' }}%
                </p>
              </li>
              <li class="keyBox">
                <p class="keyName">实名制考勤比例</p>
                <p class="quantity">
                  {{ managesystem.signNameAttReal || '0' }}%
                </p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <!-- <div class="leftSection">
      </div>-->
      <!-- 右边模块 -->
      <div class="rightSection">
        <transition name="fade">
          <img
            src="../../../static/img/projectDetail/qrcode.png"
            v-if="qrcode"
            class="qrcode"
            @mouseover="mouseOver"
          />
          <div
            class="qrcodeBox boxShadow"
            v-if="qrcodeImgCon"
            @mouseleave="mouseleave"
          >
            <img
              src="../../../static/img/projectDetail/qrcode.png"
              class="qrcodeTwo"
            />
            <img :src="qrcodeBoxUrl" alt />
            <div class="content">
              1.使用工匠365APP扫一扫即可
              <br />快速录入人员加入本项目； <br />2.使用和谐用工APP扫一扫可快
              <br />速查看项目信息。 <br />※建议
              <a
                href="javascript:;"
                download="二维码"
                @click="downLoad"
                class="driveDownload"
                >下载</a
              >后打印，与维权公示牌一同张贴
            </div>
          </div>
        </transition>
        <!-- 快捷功能盒子 -->
        <div class="functionAndQrcodeBox clearfix">
          <div class="functionBox fl">
            <p class="modularTitle">快捷功能</p>
            <div class="functionBtn fl">
              <el-button
                class="commonBut saveBtn functionItemChange"
                icon="iconfont icontianjiarenyuan"
                @click="addEmployeeDynamic"
                >添加人员</el-button
              >
            </div>
            <div class="functionBtn fr">
              <el-button
                class="commonBut saveBtn functionItemChange"
                icon="iconfont icongongzidaifa"
                @click="makeSalary('/home/salaryDf/companySalaryBatchList')"
                >工资代发</el-button
              >
            </div>
          </div>
        </div>
        <!-- 政策要点 -->
        <div class="policyBox" id="niceScroll">
          <div class="titleWord">政策要点</div>
          <ul class="contentBox clearfix" v-if="policyTotal > 0">
            <li
              style="width: 100%; height: 70px"
              v-for="(item, index) of policyData"
              :key="index"
              class="fl"
            >
              <span>【{{ item.infoTypeDesc }}】</span>
              <span class="noticeTitle" :title="item.title"
                >{{ item.title }} {{ func('noticeTitle') }}</span
              >
              <el-link
                type="primary"
                class="fr seeContent"
                @click="
                  skipPolicy(
                    item.id,
                    item.title,
                    item.type,
                    item.range,
                    '/home/notice/inforList'
                  )
                "
                >查看全文>></el-link
              >
            </li>
          </ul>
          <div v-else class="noData">暂无政策要点数据</div>
        </div>
      </div>
    </div>
    <!-- 弹窗 -->
    <el-dialog
      title="设置停工"
      :visible.sync="formStopVisible"
      :close-on-click-modal="false"
      @close="closeDialog('stop')"
      custom-class="brand-dialog-min-width"
      width="640px"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formDataStop"
        label-width="80px"
        :rules="formRulesStop"
        ref="formDataStop"
      >
        <el-form-item label="停工日期" prop="operateDate">
          <el-date-picker
            type="date"
            placeholder="请选择停工开始的日期"
            v-model="formDataStop.operateDate"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptions"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="停工原因" prop="operateReason">
          <el-input
            type="textarea"
            v-model="formDataStop.operateReason"
            autocomplete="off"
            placeholder="请输入停工原因"
            maxlength="200"
            show-word-limit
            rows="3"
            class="mWidth"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="cancelEdit('stop')" class="cancel"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click.native="updateProjectState('stop', 'formDataStop')"
          class="save"
          >保存</el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      title="设置竣工"
      :visible.sync="formOverVisible"
      :close-on-click-modal="false"
      @close="closeDialog('over')"
      custom-class="brand-dialog-min-width"
      width="32%"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formDataOver"
        label-width="80px"
        :rules="formRulesOver"
        ref="formDataOver"
      >
        <el-form-item label="竣工日期" prop="operateDate">
          <el-date-picker
            type="date"
            placeholder="请选择项目实际竣工的日期"
            v-model="formDataOver.operateDate"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptions"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="竣工原因" prop="operateReason">
          <el-input
            type="textarea"
            v-model="formDataOver.operateReason"
            autocomplete="off"
            placeholder="请输入竣工原因"
            maxlength="200"
            show-word-limit
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="cancelEdit('over')" class="cancel"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click.native="updateProjectState('over', 'formDataOver')"
          class="save"
          >保存</el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      title="恢复开工"
      :visible.sync="formAgainStartVisible"
      :close-on-click-modal="false"
      @close="closeDialog('againStart')"
      custom-class="brand-dialog-min-width"
      width="32%"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formDataAgainStart"
        label-width="80px"
        :rules="formRulesAgainStart"
        ref="formDataAgainStart"
      >
        <el-form-item label="恢复日期" prop="operateDate">
          <el-date-picker
            type="date"
            placeholder="请选择开工开始的日期"
            v-model="formDataAgainStart.operateDate"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptions"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="恢复原因" prop="operateReason">
          <el-input
            type="textarea"
            v-model="formDataAgainStart.operateReason"
            autocomplete="off"
            placeholder="请输入恢复原因"
            maxlength="200"
            show-word-limit
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="cancelEdit('againStart')" class="cancel"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click.native="updateProjectState('start', 'formDataAgainStart')"
          class="save"
          >保存</el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      title="设置完工"
      :visible.sync="formFinishVisible"
      :close-on-click-modal="false"
      @close="closeDialog('finish')"
      custom-class="brand-dialog-min-width"
      width="32%"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formDataFinish"
        label-width="80px"
        :rules="formRulesFinish"
        ref="formDataFinish"
      >
        <el-form-item label="完工日期" prop="operateDate">
          <el-date-picker
            type="date"
            placeholder="请选择项目实际完工的日期"
            v-model="formDataFinish.operateDate"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptions"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="完工原因" prop="operateReason">
          <el-input
            type="textarea"
            v-model="formDataFinish.operateReason"
            autocomplete="off"
            placeholder="请输入完工原因"
            maxlength="200"
            show-word-limit
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click.native="cancelEdit('finish')" class="cancel"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click.native="updateProjectState('finish', 'formDataFinish')"
          class="save"
          >保存</el-button
        >
      </div>
    </el-dialog>
    <!-- 详情弹框 -->
    <projectDetailPage
      v-if="projectDetailShow"
      @closeDia="getCloseDia"
      :projectId="projectId"
    ></projectDetailPage>
    <!-- 待完善弹窗 -->
    <projectInfoDialog
      v-if="projectInfoVisible"
      @closeDialog="enterIndex"
      :projectId="projectId"
    ></projectInfoDialog>
    <!-- 项目历时状态变更弹框 -->
    <projectHistoryChange
      v-if="historyChangeDia"
      @closeDialog="hiddenDialog"
      :projectId="projectId"
    ></projectHistoryChange>
  </div>
</template>

<script>
import common from '../../kits/common'
import projectDetailPage from '@/components/monitorProjectManagement/projectDetailPage'
import Guide from './guideHome'
import projectInfoDialog from '@/components/monitorProjectManagement/projectInfoDialog'
//引入vue数字滚动插件vue-countTo
import countTo from 'vue-count-to'
import projectHistoryChange from '@/components/publicCom/projectHistoryChange'
export default {
  name: 'subcontractHome',
  components: {
    projectDetailPage,
    Guide,
    projectInfoDialog,
    projectHistoryChange,
  },
  data() {
    return {
      tableData: [],
      firstProject: false,
      isEsUsers: false,
      projectInfoVisible: false, //是否有待完善
      historyChangeDia: false, //项目历时状态弹框
      dangerousProjects: [], //风险项目数据
      dangerousDataTotal: 0,
      formStopVisible: false, //设置停工弹框
      formOverVisible: false, //设置竣工弹框
      formAgainStartVisible: false, //恢复开工
      formDataStop: {
        operateDate: '',
        operateReason: '',
      },
      formRulesStop: {
        operateDate: [
          {
            required: true,
            message: '停工日期不能为空',
            trigger: 'change',
          },
        ],
        operateReason: [
          {
            required: true,
            message: '请输入停工原因',
            trigger: 'blur',
          },
        ],
      },
      formDataOver: {
        operateDate: '',
        operateReason: '',
      },
      formRulesOver: {
        operateDate: [
          {
            required: true,
            message: '竣工日期不能为空',
            trigger: 'change',
          },
        ],
        operateReason: [
          {
            required: true,
            message: '请输入竣工原因',
            trigger: 'blur',
          },
        ],
      },
      formDataAgainStart: {
        operateDate: '',
        operateReason: '',
      },
      formRulesAgainStart: {
        operateDate: [
          {
            required: true,
            message: '恢复日期不能为空',
            trigger: 'change',
          },
        ],
        operateReason: [
          {
            required: true,
            message: '请输入恢复原因',
            trigger: 'blur',
          },
        ],
      },
      formFinishVisible: false,
      formDataFinish: {
        operateDate: '',
        operateReason: '',
      },
      formRulesFinish: {
        operateDate: [
          {
            required: true,
            message: '完工日期不能为空',
            trigger: 'change',
          },
        ],
        operateReason: [
          {
            required: true,
            message: '请输入完工原因',
            trigger: 'blur',
          },
        ],
      },
      projectId: '', //列表id4201011
      companyType: '', //企业类型 JG建设方 SG施工方
      topInfo: {
        projectName: '',
        state: '',
        stateName: '',
        createTime: '', //建档日期
        date: '',
        period: '',
        endDay: '',
        hasUpload: '', //维权公示牌是否上传
      },
      publicSign: {
        imgUrl: '', //公示牌路径
        srcList: [], //
      },
      uploadUrl: '',
      changeUploadUrl: '', //替换公示牌
      uploadData: {
        projectId: '', //公示牌传项目id
      },
      pickerOptions: this.processDate(),
      path: '',
      titleprojectName: '',
      activeName: 'first',
      alertTotal: 0,
      checkTotal: 0,
      alertData: [],
      checkData: [],
      gradeLevel: '', //评级
      projectScoreId: '',
      hasSalaryAccount: false,
      accountInfo: '', //专户分拨账户
      employeeInfo: '', //人员实时动态
      managesystem: '', //实名制管理制度落实情况
      salaryInfo: '', //工资代发信息
      salaryDay: '',
      noRealName: true, //判断没有实名制
      noSalary: true, //表示没有工资
      policyData: [], //政策要点数据
      policyTotal: 0,
      bzjInfo: '', //保证金
      hasInsurance: false,
      insuranceTotal: 0,
      insuranceInfo: {},
      isShowUpdate: '',
      projectList: [], //项目名称列表
      projectDetailShow: false, //详情弹框是否显示
      qrcodeBoxUrl: '', //二维码图片
      qrcodeImgCon: false, //二维码整体
      qrcode: true,
      isShowDetail: '',
      isShowScore: false,
      isShowDanger: false,
    }
  },
  async created() {
    //获取项目列表
    await this.getProjectList()
    await this.getImproveProject()
    if (window.localStorage.getItem('firstProject')) {
      let arr = JSON.parse(window.localStorage.getItem('firstProject'))
      let nickname = this.$store.state.nickName
      let flag = false
      arr.forEach((element) => {
        if (element.nickname == nickname) {
          flag = true
        }
      })
      if (!flag) {
        this.firstProject = true
      }
    } else {
      this.firstProject = true
    }
    //获取风险项目数据
    // this.getDangerData();
    //获取政策要点数据
    this.getPlicyData()
    // 上传图片路径
    this.uploadUrl = common.commonApi + 'api-f/files/upload'
    this.isShowUpdate =
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('accountList:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('projectList:update') > -1
    this.isShowDetail =
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('accountList:detail') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('projectList:detail') > -1
    this.isEsUsers = this.isEsUser()
    if (this.isEsUser()) {
      this.isShowScore = false
      this.isShowDanger = false
    } else {
      this.isShowScore = false
      this.isShowDanger = false
    }
  },
  mounted() {
    //政策要点滚动显示
    $('#niceScroll').niceScroll({
      cursorwidth: '10px',
      cursoropacitymax: 0.5,
    })
    this.clickDocument()
  },
  methods: {
    toHistoryChange() {
      this.historyChangeDia = true
    },
    //关闭历时动态弹框
    hiddenDialog() {
      this.historyChangeDia = false
    },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex === 1) {
        return 'warning-row'
      } else if (rowIndex === 3) {
        return 'success-row'
      }
      return ''
    },
    //已经阅读过项目看板指导页面
    // setRead() {
    //   this.firstProject = false;
    //   window.localStorage.setItem("firstProject",JSON.stringify([{read: true,nickname: this.$store.state.nickName}]) );
    // },
    //已经阅读过项目看板指导页面
    setRead() {
      this.firstProject = false
      if (window.localStorage.getItem('firstProject')) {
        let arr = JSON.parse(window.localStorage.getItem('firstProject'))
        let nickname = this.$store.state.nickName
        let flag = false
        arr.forEach((element) => {
          if (element.nickname == nickname) {
            flag = true
          }
        })
        if (!flag) {
          arr.push({ read: true, nickname: this.$store.state.nickName })
          window.localStorage.setItem('firstProject', JSON.stringify(arr))
        }
      } else {
        window.localStorage.setItem(
          'firstProject',
          JSON.stringify([{ read: true, nickname: this.$store.state.nickName }])
        )
      }
    },
    enterIndex() {
      this.projectInfoVisible = false
    },
    //是否有待完善项目
    getImproveProject() {
      return this.axios({
        method: 'post',
        url: '/api-p/project/base/findprojectbyuser',
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.projectInfoVisible = response.data.result ? true : false
            // this.projectInfoVisible=true
          }
        })
        .catch((error) => {
          this.$message.error('数据获取失败')
        })
    },
    // 移入
    mouseOver() {
      this.qrcodeImgCon = true
      this.qrcode = false
    },
    //移出
    mouseleave() {
      this.qrcodeImgCon = false
      this.qrcode = true
    },
    clickDocument() {
      $(document).click(() => {
        this.qrcodeImgCon = false
        this.qrcode = true
      })
    },
    downLoad() {
      window.open(
        common.commonApi + 'api-p/project/base/downqr?info=' + this.projectId
      )
    },
    //获取项目列表
    getProjectList() {
      return this.axios({
        method: 'post',
        url: '/api-u/userpro/current',
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              var data = response.data.result
              this.$store.commit('SET_INFO', [
                'projectName',
                data.projects[0].projectName,
              ])
              this.$store.commit('SET_INFO', ['companyName', data.companyName])
              this.projectId = data.checkId
                ? data.checkId
                : data.projects[0].projectId
              this.$store.commit('SET_INFO', ['projectId', this.projectId])
              this.projectList = data.projects
              this.titleprojectName = data.projects[0].projectName
              this.useFunction()
              this.isClearAccount(this.projectId)
            }
          },
          (res) => {
            this.$message.error('项目数据获取失败')
          }
        )
        .catch((error) => {
          //   this.$message.error("项目数据获取失败");
        })
    },
    changeProject(projectId, projectName) {
      this.infos = {}
      this.projectId = projectId
      this.projectName = projectName
      this.useFunction()
      //记录当前id，确保下次登录展示上一次浏览的看板首页
      this.recordCurrentProject(this.projectId)
      //项目切换判断该项目专户是否清除
      this.isClearAccount(this.projectId)
    },
    recordCurrentProject(projectId) {
      this.axios({
        method: 'post',
        url: '/api-u/userpro/changepro',
        data: {
          projectId: projectId,
        },
      })
        .then((res) => {})
        .catch((resp) => {})
    },
    useFunction() {
      this.$nextTick(function () {
        //公示牌参数
        this.uploadData.projectId = this.projectId
        //二维码路径
        this.qrcodeBoxUrl =
          common.commonApi + 'api-p/project/base/qrimage?info=' + this.projectId
        //获取项目详情信息
        this.getProjectInfo(this.projectId)
        //获取风险项目数据
        // this.getDangerData(this.projectId);
        //保证金信息
        this.getBzjInfo(this.projectId)
        //获取工伤保险信息
        // this.getInsurranceInfo(this.projectId);
        //获取公示牌
        this.getPublicSign(this.projectId)
        //项目评级
        this.getLevel(this.projectId)
        //获取预警信息
        this.getAlertInfo(this.projectId)
        //获取待处理审核数据
        this.getCheckInfo(this.projectId)
        //分账管理
        this.getAccount(this.projectId)
        //实名制
        this.getEmployee(this.projectId, this.$store.state.uscc)
        //代办列表项
        this.getFblist(this.projectId, this.$store.state.uscc)
        //实名制落实情况
        this.getManagesystem(this.projectId)
        //工资代发
        this.getSalary(this.projectId)
      })
    },
    //获取风险项目数据
    getDangerData(projectId) {
      this.axios({
        method: 'post',
        url: 'api-ps/creditProjScorDetail/expand/findProjectRiskByCompany',
        data: {
          projectId: projectId,
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            this.dangerousDataTotal = res.data.result.length
            this.dangerousProjects = res.data.result
          } else {
            this.$message.error('项目风险数据获取失败')
          }
        })
        .catch((resp) => {
          //
        })
    },
    openDialog(getParams) {
      if (getParams == 'stop') {
        this.formStopVisible = true
      } else if (getParams == 'over') {
        this.formOverVisible = true
      } else if (getParams == 'againStart') {
        this.formAgainStartVisible = true
      } else if (getParams == 'finish') {
        this.formFinishVisible = true
      }
    },
    //关闭停工弹窗
    closeDialog(getParams) {
      if (getParams == 'stop') {
        this.$refs.formDataStop.resetFields()
      } else if (getParams == 'over') {
        this.$refs.formDataOver.resetFields()
      } else if (getParams == 'againStart') {
        this.$refs.formDataAgainStart.resetFields()
      } else if (getParams == 'finish') {
        this.$refs.formDataFinish.resetFields()
      }
    },
    //停工弹框取消
    cancelEdit(getParams) {
      if (getParams == 'stop') {
        this.formStopVisible = false
        this.$refs.formDataStop.resetFields()
      } else if (getParams == 'over') {
        this.formOverVisible = false
        this.$refs.formDataOver.resetFields()
      } else if (getParams == 'againStart') {
        this.formAgainStartVisible = false
        this.$refs.formDataAgainStart.resetFields()
      } else if (getParams == 'finish') {
        this.formFinishVisible = true
        this.$refs.formDataFinish.resetFields()
      }
    },
    //保存恢复开工、竣工、停工 参数（表单状态，表单名字）
    updateProjectState(status, formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          //传值后台
          var data = ''
          if (status === 'start') {
            //恢复开工
            data = {
              projectId: this.projectId,
              status: 'STARTED',
              date: this.formDataAgainStart.operateDate,
              reason: this.formDataAgainStart.operateReason,
            }
          }
          if (status === 'stop') {
            //设置停工
            data = {
              projectId: this.projectId,
              status: 'STOPPED',
              date: this.formDataStop.operateDate,
              reason: this.formDataStop.operateReason,
            }
          }
          if (status === 'over') {
            //恢复竣工
            data = {
              projectId: this.projectId,
              status: 'COMPLETED',
              date: this.formDataOver.operateDate,
              reason: this.formDataOver.operateReason,
            }
          }
          if (status === 'finish') {
            //设置完工
            data = {
              projectId: this.projectId,
              status: 'FINISHED',
              date: this.formDataFinish.operateDate,
              reason: this.formDataFinish.operateReason,
            }
          }
          this.updateStateAjax(status, data)
        } else {
          return false
        }
      })
    },
    //保存恢复开工、竣工、停工表单
    updateStateAjax(status, data) {
      this.axios({
        method: 'post',
        url: 'api-p/projectstatus/expand/changestatus',
        data: data,
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.$message({
                message: '设置成功',
                type: 'success',
              })
              this.$nextTick(function () {
                //关闭弹窗
                if (status === 'start') {
                  //恢复开工
                  //获取项目详情
                  this.getProjectInfo()
                  this.formAgainStartVisible = false
                  this.$refs.formDataAgainStart.resetFields()
                }
                if (status === 'stop') {
                  //设置停工
                  //获取项目详情
                  this.getProjectInfo()
                  this.formStopVisible = false
                  this.$refs.formDataStop.resetFields()
                }
                if (status === 'over') {
                  //恢复竣工
                  //获取项目详情
                  this.getProjectInfo()
                  this.formOverVisible = false
                  this.$refs.formDataOver.resetFields()
                }
                if (status === 'finish') {
                  //恢复竣工
                  //获取项目详情
                  this.getProjectInfo()
                  this.formFinishVisible = false
                  this.$refs.formDataFinish.resetFields()
                }
              })
            } else {
              this.$message({
                message: res.data.errorMsg,
                type: 'error',
              })
            }
          },
          (res) => {
            this.$message({
              message: res.data.errorMsg,
              type: 'error',
            })
          }
        )
        .catch((error) => {})
    },
    //上传公示牌失败
    uploadError() {
      this.$message({
        message: '上传失败',
        type: 'error',
      })
    },
    //上传公示牌成功将图片返给后台
    uploadSuccess(file) {
      //重新将图片信息传给后台
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/uploadpublic',
        data: {
          file: JSON.stringify(file),
          projectId: this.projectId,
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.$message({
                message: '上传成功',
                type: 'success',
              })
              this.topInfo.hasUpload = '已上传'
              this.publicSign.imgUrl = file.url
              this.publicSign.srcList = []
              this.publicSign.srcList.push(file.url)
            } else {
              this.$message({
                message: res.data.errorMsg,
                type: 'error',
              })
            }
          },
          (res) => {
            this.$message({
              message: res.data.errorMsg,
              type: 'error',
            })
          }
        )
        .catch((error) => {})
    },
    //替换成功将图片返给后台
    changeUploadSuccess(file) {
      //重新将图片信息传给后台
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/reuploadpublic',
        data: {
          file: JSON.stringify(file),
          projectId: this.projectId,
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.$message({
                message: '上传成功',
                type: 'success',
              })
              this.publicSign.imgUrl = file.url
              this.publicSign.srcList = []
              this.publicSign.srcList.push(file.url)
            } else {
              this.$message({
                message: '替换失败',
                type: 'success',
              })
            }
          },
          (res) => {
            this.$message({
              message: res.data.errorMsg,
              type: 'error',
            })
          }
        )
        .catch((error) => {})
    },
    //获取项目详情
    getProjectInfo(projectId) {
      this.axios({
        method: 'post',
        url: 'api-p/project/expand/projectdetail',
        data: {
          projectId: projectId,
        },
      })
        .then(
          (res) => {
            var data = res.data.result
            this.topInfo.projectName = data.projectName
            this.topInfo.state = data.status
            this.topInfo.stateName = data.statusDesc
            this.topInfo.createTime = data.createTime
            this.topInfo.date = data.startDate
            this.topInfo.period = data.cycle
            this.topInfo.endDay = data.disDate
            this.salaryDay = data.salaryDay
          },
          (res) => {
            this.$message({
              message: '加载详情失败',
              type: 'error',
            })
          }
        )
        .catch((error) => {
          //
        })
    },
    //打开弹框
    seeProjectDetail() {
      this.projectDetailShow = true
    },
    //关闭弹框
    getCloseDia(val) {
      this.projectDetailShow = val
    },
    //获取公示牌
    getPublicSign(projectId) {
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/showpublic',
        data: {
          projectId: projectId,
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              //如果为true，则未上传公示牌
              this.topInfo.hasUpload = '已上传'
              var data = res.data.result
              this.publicSign.imgUrl = data.absolutePath
              this.publicSign.srcList.push(data.absolutePath)
            } else {
              this.topInfo.hasUpload = '未上传'
            }
          },
          (res) => {
            this.$message({
              message: '加载公示牌失败',
              type: 'error',
            })
          }
        )
        .catch((error) => {})
    },
    //添加人员
    addEmployee(routerUrl) {
      this.$router.push({
        name: 'projectEmployeeQY',
        path: '/home/employee/projectEmployeeQY',
        query: {
          projectId: this.projectId,
          projectName: this.topInfo.projectName,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/employee/projectEmployeeQY',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    /**
     * @description: 添加实名制落实情况
     */
    addEmployeemanage() {
      this.$router.push({
        name: 'fbConstructAttendanceContainer',
        path: '/home/constructAttendance/fbConstructAttendanceContainer',
        query: {
          projectId: this.projectId,
          projectName: this.topInfo.projectName,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/constructAttendance/fbConstructAttendanceContainer',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    /**
     * @description: 查看更多代办事项
     */
    lookMore() {
      this.$router.push({
        name: 'companySalaryBatchList',
        path: '/home/salaryDf/companySalaryBatchList',
        query: {
          stateFB: 'REJECTED',
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/salaryDf/companySalaryBatchList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    /**
     * @description: 代办事项去处理
     */
    handleClick(row) {
      this.$router.push({
        path: '/home/constructSalary/editConstructSalary',
        name: 'editConstructSalary',
        query: {
          salaryId: row.id,
          month: row.month,
          year: row.year,
          projectId: row.projectId,
          projectName: row.projectName,
          type: 'list',
          sequenceCode: row.sequenceCode,
          batchNoInfo:
            row.year + '年' + row.month + '月第' + row.batchNo + '批次工资',
          isRejecded: row.status == 'REJECTED' ? 1 : 0,
          rejectReason: row.rejectReason,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/salaryDf/companySalaryBatchList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    // 弹框竣工，停工中日期限制
    processDate() {
      var that = this
      return {
        disabledDate(time) {
          var hiringTime = that.topInfo.date.toString()
          // 解决在ie中的兼容问题 需要转成/
          hiringTime = hiringTime.replace(/\./g, '/')
          if (hiringTime) {
            return time.getTime() < new Date(hiringTime).getTime()
          }
        },
      }
    },
    //限制公示牌大小
    limitSize(file) {
      let types = file.type.split('/')
      if (!['png', 'jpg', 'jpeg', 'PNG', 'JPG', 'JPEG'].includes(types[1])) {
        this.$message({
          message: `请选择png，jpg，jpeg的图片`,
          type: 'warning',
        })
        return false
      }
      if (file.size > 5 * 1024 * 1024) {
        this.$message.error('请上传5M以内的图片')
        return false
      }
    },

    //制作工资表
    makeSalary(routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'companySalaryBatchList',
          path: '/home/salaryDf/companySalaryBatchList',
          query: {
            projectId: this.projectId,
            projectName: this.topInfo.projectName,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/salaryDf/companySalaryBatchList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    func(cname) {
      var cname = document.getElementsByClassName(cname)
      for (var i = 0; i < cname.length; i++) {
        var nowLength = cname[i].innerHTML.length
        if (nowLength > 40) {
          cname[i].innerHTML = cname[i].innerHTML.substr(0, 40) + '...'
        }
      }
    },
    //获取政策要点数据
    getPlicyData() {
      this.axios({
        method: 'post',
        url: 'api-i/info/expand/listbypage',
        data: {
          // pageNo: 1,
          // pageSize: 10,
          status: '02',
          type: '05',
          reveiveUserType: 'PROJECT',
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.policyTotal = res.data.result.totalCount
              this.policyData = res.data.result.results
            } else {
              this.$message.error('政策要点数据获取失败')
            }
          },
          (res) => {
            this.$message.error('政策要点数据获取失败')
          }
        )
        .catch((error) => {
          //
        })
    },
    //跳转政策要点详情
    skipPolicy(id, title, type, range, routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'inforDetail',
          path: '/home/notice/inforDetail',
          query: {
            status: '02',
            id: id,
            title: title,
            type: type,
            range: range,
            pathUrl: '/home',
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/notice/inforList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    getBzjInfo(projectId) {
      this.axios({
        method: 'post',
        url: 'api-d/deposit/expand/projectdepositdetail',
        data: {
          projectId: projectId,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.bzjInfo = response.data.result
          }
        })
        .catch((error) => {
          // this.$message.error("专户数据获取失败");
        })
    },
    //获取工伤保险数据
    getInsurranceInfo(projectId) {
      this.axios({
        method: 'post',
        url: 'api-e/cs/ins/expand/inslist',
        data: {
          projectId: projectId,
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.insuranceTotal = res.data.result.length
              if (res.data.result.length > 0) {
                this.hasInsurance = true
                this.insuranceInfo = res.data.result[0]
              } else {
                this.hasInsurance = false
              }
            } else {
              this.$message.error('工伤保险数据获取失败')
            }
          },
          (res) => {
            this.$message.error('工伤保险数据获取失败')
          }
        )
        .catch((error) => {
          //   console.log("工伤保险数据获取失败");
        })
    },
    addEmployeeDynamic() {
      this.$router.push({
        name: 'projectEmployeeFb',
        path: '/home/employee/projectEmployeeFb',
        query: {
          projectId: this.projectId,
          projectName: this.topInfo.projectName,
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/employee/projectEmployeeFb',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    skipAddInsurrance() {
      if (this.isEsUser()) {
        this.$router.push({
          name: 'EsInsurance',
          path: '/home/EsInsurance/EsInsurance',
        })
      } else {
        this.$router.push({
          name: 'insurance',
          path: '/home/insurance/insurance',
          query: {
            projectId: this.projectId,
            projectName: this.topInfo.projectName,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/insurance/insurance',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
      this.getAreaInfo()
    },
    //跳转工伤保险
    skipInsurrance(routerUrl) {
      console.log(1)
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          // name: "insurance",
          path: routerUrl,
          query: {
            projectId: this.projectId,
            projectName: this.topInfo.projectName,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: routerUrl,
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    numberFormat(value) {
      var param = {}
      var k = 10000,
        sizes = ['', '万', '亿'],
        len = sizes.length,
        i
      if (value < k) {
        param.value = value
        param.unit = ''
      } else {
        i = Math.floor(Math.log(value) / Math.log(k))
        i = i > len - 1 ? len - 1 : i
        param.value = (value / Math.pow(k, i)).toFixed(2)
        param.unit = sizes[i]
      }
      return param.value + param.unit
    },
    getLevel(projectId) {
      this.axios({
        method: 'post',
        url: 'api-ps/creditProjectScore/expand/projectScoreByLatest',
        data: {
          projectId: projectId,
        },
      })
        .then((res) => {
          if (res.data.result.length != 0) {
            this.gradeLevel = res.data.result[0].gradeLevel
            this.projectScoreId = res.data.result[0].id
          } else {
            this.gradeLevel = ''
            this.id = ''
          }
        })
        .catch((error) => {})
    },
    xfCredit(routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'projectScoreDetail',
          path: '/home/enterpriseScore/projectScoreDetail',
          query: {
            projectId: this.projectId,
            projectScoreId: this.projectScoreId,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/enterpriseScore/projectScoreList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //获取预警数据
    getAlertInfo(projectId) {
      this.axios({
        method: 'post',
        url: 'api-a/cs/alert/expand/projectalert',
        data: {
          projectId: projectId,
          pageSize: 4,
          pageNo: 1,
          status: '["01"]', //未处理
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.alertTotal = res.data.result.total
              this.alertData = res.data.result.results
            } else {
              this.$message.error('预警数据获取失败')
            }
          },
          (res) => {
            this.$message.error('预警数据获取失败')
          }
        )
        .catch((error) => {
          this.$message.error('预警数据获取失败')
        })
    },
    //跳转预警
    skipAlert(routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'constructAlertProjectList',
          path: '/home/project/constructAlertProjectList',
          query: {
            projectId: this.projectId,
            projectName: this.topInfo.projectName,
            status: '01',
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/project/constructAlertProjectList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    //获取待审核数据
    getCheckInfo(projectId) {
      this.axios({
        method: 'post',
        url: 'api-e/cs/application/expend/listbypage',
        data: {
          projectId: projectId,
          pageSize: 4,
          pageNo: 1,
          status: 'AUDIT', //未处理
        },
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.checkTotal = res.data.result.total
              this.checkData = res.data.result.results
            } else {
              this.$message.error('待审核数据获取失败')
            }
          },
          (res) => {
            this.$message.error('待审核数据获取失败')
          }
        )
        .catch((error) => {
          this.$message.error('待审核数据获取失败')
        })
    },
    //跳转人员申请
    skipApplyEmployee(routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'projectEmployeeApply',
          path: '/home/employee/projectEmployeeApply',
          query: {
            projectId: this.projectId,
            status: 'AUDIT',
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/employee/projectEmployeeApply',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    getAccount(projectId) {
      this.axios({
        method: 'post',
        url: 'api-acc/account/expand/findaccountbyprojectid',
        data: {
          projectId: projectId,
        },
      })
        .then((res) => {
          if (!res.data.hasError) {
            var data = res.data.result
            this.hasSalaryAccount = data.hasSalaryAccount
            if (this.hasSalaryAccount == true) {
              this.accountInfo = res.data.result
            }
          }
        })
        .catch((error) => {})
    },
    /**
     * @description: 获取人员实时动态
     * @param {*} projectId
     */
    getEmployee(projectId, uscc) {
      this.axios({
        method: 'post',
        url: 'api-p/projectcompany/expand/findproandcomstats',
        data: {
          projectId: projectId,
          uscc: uscc,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.employeeInfo = response.data.result
            this.noRealName = response.data.result.noRealName
          }
        })
        .catch((response) => {})
    },
    /**
     * @description: 获取代办列表项
     * @param {*} projectId
     */
    getFblist(projectId, uscc) {
      this.axios({
        method: 'post',
        url: 'api-su/cs/salary/expand/fblist',
        data: {
          projectId: projectId,
          uscc: uscc,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            if (response.data.result.results.length > 3) {
              this.tableData = response.data.result.results.slice(0, 3)
            } else {
              this.tableData = response.data.result.results
            }
          }
        })
        .catch((response) => {})
    },
    /**
     * @description: 获取实名制落实情况
     * @param {*} projectId
     */
    getManagesystem(projectId) {
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/projectrealnamestatisticsFB',
        data: {
          projectId: projectId,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            console.log(response.data.result)
            this.managesystem = response.data.result
            this.noRealName = response.data.result.noRealName
          }
        })
        .catch((response) => {})
    },
    getSalary(projectId) {
      this.axios({
        method: 'post',
        url: 'api-su/cs/salarystats/expand/salarydistribution',
        data: {
          projectId: projectId,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.salaryInfo = response.data.result
            this.noSalary = response.data.result.noSalary
          }
        })
        .catch((response) => {})
    },
    //添加专户
    addAccountInfo(routerUrl) {
      if (this.accessControl(routerUrl) == -1) {
        this.goNoAccessPage()
      } else {
        this.$router.push({
          name: 'specialAccountList',
          path: '/home/specialAccount/specialAccountList',
          query: {
            projectId: this.projectId,
            projectName: this.projectName,
          },
        })
        this.$store.commit('CHANGE_SLIDER_NAME', {
          oldUrl: '/home/specialAccount/specialAccountList',
          newUrl: this.$router.currentRoute.fullPath,
        })
      }
    },
    showPic() {
      $('#publicSignBox').click()
    },
    updateProjectInfo() {
      this.$router.push({
        path: '/home/monitorProjectManagement/projectInfoUpd',
        name: 'projectInfoUpd',
        query: {
          projectId: this.projectId,
          paramsType: 'projectHome', //项目端首页标识
          isFB: true, //项目端首页标识
        },
      })
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/indexHome/projectHome',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    isClearAccount(projectId) {
      this.axios({
        method: 'post',
        url: 'api-acc/companyaccount/expand/isUpdate',
        data: {
          projectId: projectId,
        },
      }).then((response) => {
        //专户被清除为true，专户没被清除为false
        if (response.data.hasError) {
          this.showTip()
        } else {
        }
      })
    },
    showTip(oldGroup, typeName) {
      this.$confirm(
        '您的项目施工方已被修改，原有施工方的统一专户无法使用，请重新录入工资专户',
        {
          confirmButtonText: '去添加',
          type: 'warning',
          center: true,
          showClose: false,
          showCancelButton: false,
        }
      )
        .then((action) => {
          //去添加则跳转至分账管理-专户列表页面；
          this.$router.push({
            path: '/home/specialAccount/specialAccountList',
            name: 'specialAccountList',
          })
          this.$store.commit('CHANGE_SLIDER_NAME', {
            oldUrl: '/home/specialAccount/specialAccountList',
            newUrl: this.$router.currentRoute.fullPath,
          })
        })
        .catch(() => {})
    },
  },
}
</script>

<style scoped lang="less">
.redColor {
  color: #e02020;
}
.greenBack {
  background-color: #009588;
}
.greyBack {
  background-color: #647382;
}
.redBack {
  background-color: #db534b;
}
.yellowBack {
  background-color: #ffc200;
}
.font16 {
  font-size: 16px;
}
.titleBox {
  border: none;
}
.seeDetail,
.updateInfo {
  vertical-align: top;
}
.seeDetail {
  margin: 0 10px;
}
.modularTitle {
  font-size: 18px;
  line-height: 18px;
  color: #333;
}
.inline-block {
  display: inline-block;
  vertical-align: middle;
}
.lineH67 {
  line-height: 67px;
}
.topBox {
  .projectState {
    display: inline-block;
    width: 60px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    color: #fff;
    text-align: center;
    margin-left: 10px;
    font-weight: normal;
    margin-top: 5px;
  }
  /deep/.el-input__inner {
    width: 346px;
    font: bold 20px Microsoft YaHei;
    color: #333333;
    border: none;
    height: 30px;
    background: #e4ebf1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /deep/.el-select__caret {
    color: #333;
    font-size: 20px;
    line-height: 30px;
  }
}
.policyBox {
  height: 539px;
  margin-top: 10px;
  padding: 10px 15px;
  background: #fff;
  .titleWord {
    padding-left: 18px;
    line-height: 40px;
    font-size: 18px;
    color: #333;
  }
  .noData {
    text-align: center;
    margin-top: 160px;
  }
  .contentBox {
    padding-top: 10px;
    font-size: 14px;
    li {
      cursor: pointer;
      position: relative;
      padding: 12px 16px;
      line-height: 24px;
      &:nth-child(odd) {
        background: #f5f7fb;
      }
      .seeContent {
        width: 77px;
        position: absolute;
        right: 10px;
        bottom: 10px;
      }
    }
  }
}
.container {
  position: absolute;
  padding: 0;
  padding-bottom: 25px;
  top: 106px;
  left: 0px;
  bottom: 0px;
  right: 0px;
  // min-width: 1147px;
  overflow-y: auto;
  //background:grey;
  .titleWrap {
    background: #e4ebf1;
    padding: 16px 24px 24px 16px;
    position: relative;
    font-size: 14px;
    color: #333;
    position: relative;
    .backBtn {
      position: absolute;
      cursor: pointer;
      left: 24px;
      top: 23px;
      font-size: 18px;
      font-weight: bold;
      width: 18px;
      height: 24px;
      margin-right: 6px;
      .iconfanhui1 {
        margin-right: 0;
      }
    }
    .projectName {
      font: bold 18px Microsoft YaHei;
      color: #333333;
      line-height: 20px;
      margin-bottom: 10px;
      .projectState {
        display: inline-block;
        width: 60px;
        height: 20px;
        font-size: 12px;
        color: #fff;
        text-align: center;
        margin-left: 10px;
        font-weight: normal;
      }
    }
    .explain {
      font-size: 14px;
      color: #666;
      margin-top: 10px;
      padding-left: 16px;
      .historyChange {
        float: right;
      }
    }
    .titleBottom {
      line-height: 25px;
      height: 25px;
      padding-left: 16px;
    }
    .topBtn {
      position: absolute;
      top: 40px;
      right: 120px;
      .greenBack {
        border-color: #009588;
      }
    }
    .gradeImgBox {
      position: absolute;
      top: 20px;
      right: 24px;
      .gradeImgCss {
        width: 80px;
        height: 80px;
      }
    }
    .previewBox {
      width: 840px;
      height: 20px;
      position: relative;
      .previewImg {
        position: absolute;
        top: 25px;
        left: 0;
        cursor: pointer;
        /deep/.el-image__preview {
          opacity: 0;
        }
      }
    }
    /deep/.el-upload-list {
      display: none;
    }
  }
  .topTip {
    margin-top: 10px;
    width: 100%;
    font-size: 14px;
    .dangerBox {
      border: 1px solid #e02020;
      height: 34px;
      line-height: 34px;
      position: relative;
      .leftBox {
        font-size: 16px;
        position: absolute;
        left: 0;
        width: 75px;
        height: 100%;
        text-align: center;
        background-color: #e02020;
        color: #fff;
      }
      .rightBox {
        margin-left: 75px;
        padding: 0 20px;
        height: 100%;
        color: #666;
        background-color: rgba(224, 32, 32, 0.05);
      }
    }
  }
  .mainSection {
    position: relative;
    margin-top: 10px;
    // .leftSection {
    //   height: 1000px;
    //   margin-right: 432px;
    // }
    .rightSection {
      .fade-enter-active,
      .fade-leave-active {
        transition: opacity 0.3s;
      }
      .fade-enter, .fade-leave-to /* .fade-leave-active, 2.1.8 版本以下 */ {
        opacity: 0;
      }
      .boxShadow {
        box-shadow: -2px 4px 8px rgba(0, 0, 0, 0.1);
      }
      height: 442px;
      position: absolute;
      right: 0px;
      top: 0px;
      width: 422px;
      /deep/ .qrcode {
        position: fixed;
        width: 60px;
        top: 296px;
        right: 10px;
        z-index: 9999;
      }
      // 快捷功能+二维码
      .functionAndQrcodeBox {
        width: 422px;
        height: 154px;
        .functionBox {
          width: 422px;
          height: 100%;
          margin-right: 10px;
          padding: 20px 32px;
          background-color: #fff;
          .functionBtn {
            margin-top: 20px;
            .el-button {
              width: 158px;
              height: 60px;
              background: rgba(0, 149, 136, 0.65);
              border-radius: 8px;
              border-radius: 8px;
              border: none;
              font-size: 20px;
              /deep/.iconfont {
                margin-right: 10px;
              }
            }
          }
        }
      }
      // 保证金
      .bzjBox {
        height: 322px;
        background: #fff;
        margin-top: 10px;
        padding: 24px 32px;
        .title {
          font-size: 18px;
          margin-bottom: 12px;
        }
        .labelWidth {
          font-size: 14px;
          color: #333;
          display: inline-block;
          height: 32px;
        }
        .information {
          font-size: 14px;
          color: #666;
        }
        .noDeposit {
          p {
            color: #2a2a2a;
            margin-top: 110px;
            text-align: center;
          }
        }
      }
      .insuranceBox {
        // height:524px;
        background-color: #fff;
        margin-top: 10px;
        font-size: 14px;
        .titleBox {
          height: 58px;
          line-height: 58px;
          padding: 0 32px;
          // background:#E4EBF1;
          margin-bottom: 0px;
          .modularTitle {
            line-height: 58px;
          }
          .el-link {
            vertical-align: top;
          }
        }
        .contentBox {
          padding: 0 32px;
          ul li {
            height: 32px;
            line-height: 32px;
            label {
              color: #333;
              display: inline-block;
              width: 90px;
              text-align: right;
            }
            span {
              color: #2a2a2a;
            }
          }
          .borderUl {
            border: 1px dotted #d5dee7;
            border-width: 1px 0px;
            margin: 15px 0px;
            padding: 15px 0px;
          }
        }
      }
      .insuranceBox {
        height: 264px;
        position: relative;
        .contentBox {
          ul li {
            label {
              width: 70px;
            }
          }
          .addInsurance {
            position: absolute;
            right: 32px;
            bottom: 36px;
          }
          .noInsurance p {
            color: #e02020;
            font-size: 18px;
            text-align: center;
            margin-top: 45px;
            i {
              font-size: 32px;
              margin-right: 10px;
              vertical-align: middle;
            }
          }
        }
      }
    }
    .qrcodeBox {
      position: fixed;
      right: 0;
      z-index: 9999;
      width: 220px;
      height: 348px;
      background: #fff;
      padding: 20px 25px;
      border-radius: 0 0 0 30px;
      .qrcodeTwo {
        position: fixed;
        width: 60px;
        top: 303px;
        right: 206px;
      }
      img {
        width: 170px;
      }
      .content {
        font-size: 12px;
        color: #333333;
        line-height: 21px;
        margin-top: 4px;
        .driveDownload {
          color: #409eff;
          font-size: 11px;
          margin-top: 10px;
          border-bottom: 1px solid #409eff;
          text-align: center;
          &:hover {
            color: #0070f5;
            border-bottom: 1px solid #0070f5;
          }
        }
      }
    }
    .contentLeft {
      margin-right: 432px;
      .xfButton {
        margin-top: 30px;
        color: #009588;
        border: 1px solid #009588;
        padding: 10px 20px;
        &:hover {
          background: rgba(0, 149, 136, 0.1);
        }
      }
      // 代办事项
      .todoBox {
        // width: 422px;
        height: 274px;
        // margin-top: 10px;
        background-color: #ffffff;
        position: relative;
        /deep/ .el-tabs__header {
          margin: 0;
        }
        /deep/.el-tabs {
          .el-tabs__nav-wrap {
            height: 58px;
            padding: 0 32px;
            padding-top: 6px;
            // background: #E4EBF1;
            .el-tabs__item {
              color: #666;
            }
            .el-tabs__item.is-active {
              color: #009588;
            }
            .el-tabs__active-bar {
              background-color: #009588;
            }
            .el-tabs__nav {
              float: right;
            }
          }
          .el-tabs__nav-wrap::after {
            display: none;
          }
        }
        .modularTitle {
          position: absolute;
          left: 32px;
          top: 19px;
          z-index: 100;
          font-size: 18px;
        }
        .noData {
          margin-top: 70px;
        }
        .todoContentBox {
          padding: 0 16px;
          font-size: 14px;
          li {
            height: 40px;
            line-height: 40px;
            padding: 0 20px;
            .dealing {
              color: #ffb649;
            }
            .noDeal {
              color: #e02020;
            }
            &:nth-child(odd) {
              background: #f5f7fb;
            }
            &:nth-child(even) {
              border-bottom: 2px solid #f5f7fb;
            }
          }
        }
        .moreLink {
          margin-top: 10px;
        }
      }
      .scoreLeft,
      .accountBox,
      .reactBox,
      .salaryBox {
        /deep/ .el-table td,
        .el-table th {
          padding: 2px 0px;
        }
        /deep/ .el-table td,
        .el-table th.is-leaf {
          border: 0px;
        }
        .title {
          font-size: 18px;
        }
        .see-more {
          font-family: SourceHanSansCN-Normal;
          font-size: 14px;
          color: #409eff;
          cursor: pointer;
        }
        background: #fff;
        margin-bottom: 10px;
        padding: 10px 32px 10px 32px;
        .keyWrapper {
          .keyBox {
            height: 92px;
            float: left;
            width: 31.33333333%;
            background: #f5f7fb;
            margin-top: 20px;
            border-radius: 4px;
            text-align: center;
            padding: 18px 0;
            .keyName {
              font-size: 14px;
              color: #666;
              line-height: 21px;
            }
            .quantity {
              color: #009588;
              font-weight: bold;
              font-size: 28px;
              line-height: 36px;
            }
          }
          .keyBox:nth-child(3n-1) {
            margin-left: 3%;
            margin-right: 3%;
          }
        }
      }
      .scoreBox {
        height: 274px;
        margin-bottom: 10px;
        .scoreLeft {
          height: 274px;
          padding-right: 32px;
          text-align: center;
          border-right: 10px solid #f5f7fb;
          .projectLevel {
            margin-top: 30px;
            width: 100px;
          }
        }
      }
      .accountBox {
        height: 220px;
        position: relative;
        .noAccount {
          padding-top: 90px;
          text-align: center;
        }
        .accountLeft {
          margin-top: 20px;
          height: 184px;
          padding: 40px 20px;
          background: #f5f7fb;
          border: 1px solid #dee5f4;
          border-right: none;
          li {
            line-height: 34px;
            .label {
              font-size: 14px;
              color: #999999;
              margin-right: 4px;
            }
            .information {
              font-size: 14px;
              color: #333333;
            }
          }
        }
        .accountRight {
          margin-top: 20px;
          .bankInfo {
            width: 100%;
            height: 184px;
            padding: 24px 20px;
            border: 1px solid #dee5f4;
            .payoff div {
              width: 50%;
              float: left;
              margin-bottom: 20px;
              border-bottom: 1px solid #dee5f4;
            }
            .color999 {
              font-size: 14px;
            }
            .moneyAll {
              font-size: 22px;
              color: #009588;
              line-height: 50px;
            }
            .moneyLittle {
              font-size: 22px;
              color: #333;
              line-height: 50px;
            }
          }
        }
      }
      .reactBox {
        height: 282px;
        position: relative;
      }
      .persoformance {
        height: 182px;
      }
      .salaryBox {
        height: 304px;
        position: relative;
        .smallTitle {
          font-size: 14px;
          color: #999999;
        }
        .noSalary {
          p {
            color: #2a2a2a;
            margin-top: 100px;
            text-align: center;
          }
        }
      }
      .bzjBox {
        height: 210px;
        .title {
          margin-bottom: 20px;
        }
        .labelWidth {
          font-size: 14px;
          color: #333;
          display: inline-block;
          height: 34px;
        }
        .information {
          font-size: 14px;
          color: #666;
        }
        .noDeposit {
          p {
            color: #2a2a2a;
            margin-top: 60px;
            text-align: center;
          }
        }
      }
      .noRealName {
        p {
          color: #e02020;
          font-size: 18px;
          text-align: center;
          margin-top: 90px;
          i {
            font-size: 32px;
            margin-right: 10px;
            vertical-align: middle;
          }
        }
        .addEmployee {
          position: absolute;
          right: 32px;
          bottom: 24px;
        }
      }
      @media screen and (min-width: 1280px) and (max-width: 1440px) {
        .fontSize {
          font-size: 12px !important;
        }
      }
      @media screen and (min-width: 1440px) {
        .keyName {
          font-size: 16px !important;
        }
      }
    }
  }
}
// 二维码
@media screen and (max-width: 1400px) {
  .qrcode {
    top: 196px !important;
  }
  .qrcodeBox {
    top: 215px !important;
  }
  .qrcodeTwo {
    top: 203px !important;
  }
}

.clearfix:after {
  content: '.'; /*加一段内容*/
  display: block; /*让生成的元素以块级元素显示，占满剩余空间*/
  height: 0; /*避免生成的内容破坏原有布局高度*/
  clear: both; /*清除浮动*/
  visibility: hidden; /*让生成的内容不可见*/
}
.clearfix {
  zoom: 1; /*为IE6，7的兼容性设置*/
}

.headertitle {
  font-size: 36px;
  padding-left: 17px;
  font: bold 20px Microsoft YaHei;
}
.historyChange {
  // margin-top: 16px;
  font-size: 14px;
  cursor: pointer;
  color: #409eff;
  &:hcompleted {
    text-decoration: underline;
  }
}
</style>
